package com.example.myapplication;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {
    private RecyclerView mainRecyclerView;

    private ArrayList<WeatherBean> arrayList;
    private final MainAdapter adapter = new MainAdapter(arrayList);

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //实例化控件
        setContentView(R.layout.activity_main);
        mainRecyclerView=findViewById(R.id.mainRecyclerView);
        //初始化数据
        mainRecyclerView.setLayoutManager(new LinearLayoutManager(this));
        mainRecyclerView.setAdapter(adapter);
        //初始化事件
        adapter.setOnItemClickListener(new MainAdapter.OnItemClickListener() {
            @Override
            public int hashCode() {
                return super.hashCode();
            }

            @Override
            public boolean equals(@Nullable Object obj) {
                return super.equals(obj);
            }
        });
    }

}
